<ion-view view-title={{moduleTitle}}>
    <ion-nav-buttons side="left">
        <a class="button button-icon ion-arrow-left-c" ng-click="goBack()"></a>
    </ion-nav-buttons>
    <div class="tabs-striped tabs-top">
        <div class="tabs">
            <a ng-if="access.list"  ng-class="{'tab-item':true,'active': id }" href="#/{{moduleName}}/list">查看</a>
            <a ng-if="access.add"   ng-class="{'tab-item':true,'active': !id }" href="#/{{moduleName}}/0">添加</a>
            <a ng-if="access.stats" ng-class="{'tab-item':true,'active': false }" href="#/{{moduleName}}/stats">统计</a>
        </div>
    </div>
    <ion-content class="padding has-tabs-top">
        <form name="detailForm" novalidate="" ng-submit="submitForm(detailForm)">
            <div class="list">
                <insert-address  form="detailForm"  addressoption="addressOption"></insert-address>
                <insert-date  form="detailForm"  dateoption="dateOption"></insert-date>
                <insert-select form="detailForm" option="fertilizerOption"></insert-select>
                <insert-select form="detailForm" option="brandOption"></insert-select>
                <label class="item item-input">
                    <span class="input-label">S/M：</span>
                    <input type="text" name="SM" ng-model="detail.sm"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.SM.$error" role="alert">
                    <div ng-messages-include="competitors-detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">N<span style="color:red">*</span>：</span>
                    <input type="text" name="N" ng-model="detail.n"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.N.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">P<span style="color:red">*</span>：</span>
                    <input type="text" name="P" ng-model="detail.p"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.P.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">K<span style="color:red">*</span>：</span>
                    <input type="text" name="K" ng-model="detail.k"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.K.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">总含量<span style="color:red">*</span>：</span>
                    <input type="text" name="npk_total" ng-model="detail.npk_total"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.npk_total.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">出厂价格<span style="color:red">*</span>：</span>
                    <input type="text" name="factory_price" ng-model="detail.factory_price"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.factory_price.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">到站价格<span style="color:red">*</span>：</span>
                    <input type="text" name="arrival_price" ng-model="detail.arrival_price"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.arrival_price.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">零售价格<span style="color:red">*</span>：</span>
                    <input type="text" name="retail_price" ng-model="detail.retail_price"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.retail_price.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">返利<span style="color:red">*</span>：</span>
                    <input type="text" name="rebate" ng-model="detail.rebate"
                           required
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.rebate.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">销售策略：</span>
                    <input type="text" name="sales_policy" ng-model="detail.sales_policy"
                           ng-maxlength="200"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.sales_policy.$error" role="alert">
                    <div ng-messages-include="competitors-detail-maxlength-200-errors.html"></div>
                </div>
            </div>

            <button class="button button-full button-positive" ng-disabled="detailForm.$invalid || detailEdit.editDisabled" type="submit">
                {{operation}}
            </button>
        </form>
    </ion-content>
    <script id="competitors-detail-errors.html" type="text/ng-template">
        <div class="error" ng-message="maxlength">
            <i class="ion-information-circled"></i> 字符长度不能超过10个
        </div>
    </script>
    <script id="competitors-detail-maxlength-200-errors.html" type="text/ng-template">
        <div class="error" ng-message="maxlength">
            <i class="ion-information-circled"></i> 字符长度不能超过200个
        </div>
    </script>
    <!--头部和内容结束-->
</ion-view>